Ext.define('Emp.view.resource.Edit', {
	extend: 'Emp.view.BaseEdit',
	alias: 'widget.resourceedit',
	
	requires: [
		'Ext.ux.TreePicker',
		'Emp.ux.form.field.ComboTree',
		'Emp.store.ResourceQuery',
		'Emp.store.Status'
	],

	width: 300,
	height: 280,
	
	initComponent: function() {
		var me = this;
		
		me.items = [{
			xtype: 'form',
			border: false,
			bodyPadding: 5,
			layout: 'anchor',
			defaults: {
				labelAlign: 'right',
				labelWidth: 60,
				anchor: '95%'
			},
			defaultType: 'textfield',
			items: [{
					fieldLabel: 'id',
					name: 'id',
					hidden: true
				}, {
					fieldLabel: '资源名称',
					name: 'name',
					allowBlank: false
				}, {
					fieldLabel: '显示文本',
					name: 'text',
					allowBlank: false
				}, {
					fieldLabel: 'target',
					name: 'target'
				}, {
					fieldLabel: '图标',
					name: 'iconCls'
				}, {
					fieldLabel: '上级',
					name: 'parentId',
					xtype: 'combotree',
					forceSelection:true,
					treeConfig: {
						useArrows: true,
						rootVisible: true
					},
					displayField: 'text',
					valueField: 'id',
					store: Ext.create('Emp.store.ResourceQuery')
//				}, {
//					fieldLabel: '上级',
//					name: 'parentId',
//					xtype: 'treepicker',
//					forceSelection:true,
//						useArrows: true,
//						rootVisible: true,
//					displayField: 'text',
//					valueField: 'id',
//					store: Ext.create('Emp.store.ResourceQuery')
				}, {
					fieldLabel: '展开',
		            name: 'expanded',
		            xtype: 'combobox',
					store: Ext.create('Ext.data.Store', {
					    fields: ['display', 'value'],
					    data: [
					        {'display':'展开', 'value':true},
					        {'display':'闭合', 'value':false}
					    ]
					}),
					queryMode: 'local',
					displayField: 'display',
					valueField: 'value',
					forceSelection: true,
					allowBlank: false
				}, {
					fieldLabel: '状态',
					name: 'status',
					xtype: 'combobox',
					store: Ext.create('Emp.store.Status'),
					queryMode: 'local',
					displayField: 'display',
					valueField: 'value',
					forceSelection: true,
					allowBlank: false
				}, {
					fieldLabel: '排序',
					name: 'sort',
					xtype: 'numberfield',
					hideTrigger: true,
					allowDecimals:false,
					allowBlank: false
			}]
		}];
		me.callParent();
	}
});